package com.cooper.controllers.seller;

import org.springframework.beans.factory.annotation.Autowired;

import com.cooper.constants.AppConstants;
import com.cooper.constants.ResourceConstants;
import com.cooper.controllers.Controller;
import com.cooper.pagination.PageInfo;
import com.cooper.pagination.PageResult;
import com.cooper.service.seller.DesignerService;
import com.cooper.vo.DesignerSearchVo;
import com.cooper.vo.DesignerVo;

import net.paoding.rose.web.Invocation;
import net.paoding.rose.web.annotation.rest.Get;
import net.paoding.rose.web.annotation.rest.Post;

public class BrandsController extends Controller {

	@Autowired
	private DesignerService designerService;

	@Get @Post
	public String execute(Invocation inv, DesignerSearchVo searchVo, PageInfo pageInfo) throws Exception{
		searchVo.setSellerType(ResourceConstants.SellerType.INDEPENDENT_BRAND);
		pageInfo.setPageSize(ITEMS_PER_PAGE);
		PageResult<DesignerVo> pageResult = this.designerService.queryForList(searchVo, pageInfo);
		inv.addModel("entityList", pageResult.getResult());
		inv.addModel(AppConstants.pageInfo, pageInfo);
		inv.addModel("pageTitle", "BRANDS");
		return "Shops";
	}
}
